package org.mili.ticketeer.ui.meeting;

import org.mili.ticketeer.dto.Contact;
import org.mili.ticketeer.dto.ContactMeeting;
import org.mili.ticketeer.service.MeetingService;
import org.mili.application.service.ServiceFactory;
import org.mili.application.ui.ManyToManyForm;
import org.mili.application.util.Log;

/**
 * Created with IntelliJ IDEA.
 * User: papa
 * Date: 20.07.13
 * Time: 14:10
 * To change this template use File | Settings | File Templates.
 */
public class MeetingContactForm extends ManyToManyForm<Contact, ContactMeeting> {
    private static MeetingService meetingService = ServiceFactory.getService(MeetingService.class);

    public MeetingContactForm(String label) {
        super(label, new ContactMeetingTableModel());
    }

    @Override
    public void onSelectionChanged(Object element) {
        Log.log(this, "onSelectionChanged", "element: %s", element);
        if (element instanceof Contact) {
            formObject = (Contact) element;
            getTableModel().update(formObject);
        }
    }

    @Override
    public void onModelChange(Object n, Object nm) {
        Log.log(this, "onModelChanged", "n: %s, nm: %s", n, nm);
        super.fireDataChanged(n);
    }

}
